package com.fs.repository;

import com.fs.entity.Customer;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

public interface CustomerRepository extends JpaRepository<Customer, Integer>, JpaSpecificationExecutor<Customer> {
    boolean existsCustomerById(Integer id);

    Customer findByWxID(String wxID);

    boolean existsByWxID(String wxID);

    @Modifying
    @Query("update Customer set name=?2 ,avatarUrl=?3 where id=?1")
    int updateName(int id, String nickName,String avatar);

    @Modifying
    @Query("update Customer set token=?2 where id=?1")
    int updateToken(int id, String token);

}
